package code

import (
	"fmt"
	"time"
)

// 泛型是1.18 版本新增的功能
func Concurrence1() {
	start := time.Now().UnixMilli()
	task1()
	task2()
	end := time.Now().UnixMilli() - start
	fmt.Println("总共耗时：", end)
}

func task1() {
	time.Sleep(time.Second * 3)
	fmt.Println("task1 执行")
}

func task2() {
	time.Sleep(time.Second * 1)
	fmt.Println("task2 执行")
}
